// 导入插件
import '@vant/touch-emulator';
import Antd from 'ant-design-vue';
import { pinia } from "./store";
import App from './App.vue';
import router from './router';

import dayjs from './plugins/dayjs';
import eventBus from "@/utils/eventBus.js";
import { createApp } from 'vue';
import { Lazyload,ImagePreview  } from 'vant';

// 设置弹窗时间和位置
import { message } from 'ant-design-vue';
message.config({
  top: `40vh`,
  duration: 3,
  maxCount: 2,
  rtl: true,
  prefixCls: 'toast-message',
});

const app = createApp(App)
// 引入图片懒加载
app.use(Lazyload, {
  lazyComponent: true,
});
app.use(ImagePreview);
app.config.globalProperties.$dayjs = dayjs;
app.config.globalProperties.$eventBus = eventBus;
import tabs from '@/components/tabs/index.vue';
import navBar from '@/components/nav-bar/index.vue';
import tabBar from "@/components/tabbar/index.vue";
app.component('tabsBox', tabs);
app.component('navBar', navBar);
app.component('tabBar', tabBar);

// 注册全局指令
import pLoading from './directives/page-loading.js';
import scrollbar from './directives/scrollbar';
app.directive('ploading', pLoading);  // 页面loading
app.directive('scrollbar', scrollbar);  // 滚动条

app.use(Antd)
app.use(pinia)
app.use(router)


app.mount('#app')